home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12709 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Is this a C BUG??? (A string issue)
  5. Date: 2 Apr 1996 06:55:46 -0600
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4jr84i$hea@solutions.solon.com>
  8. References: <4jknpf$9k3@abel.cc.sunysb.edu> <AD84A72A96681716E4@mcdiala03.it.luc.edu> <4jp9s4INNpp2@keats.ugrad.cs.ubc.ca> <AD86126F966859743@mcdiala13.it.luc.edu>
  9. NNTP-Posting-Host: solutions.solon.com
  10.  
  11. In article <AD86126F966859743@mcdiala13.it.luc.edu>,
  12. Verne Arase <VArase@varase.it.luc.edu> wrote:
  13. >The standard I/O f<...> functions are fine for formatted I/O, and I/O where
  14. >compatible stream functions are desired, but aren't that great for fixed
  15. >length record I/O.
  16.  
  17. >read/write allow you to slam in or out a specified number of bytes
  18. >into/from a buffer; how is that restricting I/O to a single record at a
  19. >crack?
  20.  
  21. He said "a naive implementation".
  22.  
  23. fread/fwrite allow you to do just the same thing.  I have generally found
  24. that, unless the blocks I'm reading are multiples or divisors of disk block
  25. size (mostly multiples), read/write are painfully slow by comparison.  Why?
  26. Because they involve system call overhead every time I use them.  fread and
  27. fwrite frequently work with a non-trivial buffer somewhere in stdio, and
  28. are able to:
  29. 1.  Minimize calls to the system.
  30. 2.  Make sure all reads and writes are properly aligned buffers of a good
  31. block size.
  32.  
  33. Obviously, any description of how read/write are different is atopical.
  34.  
  35. -s
  36. -- 
  37. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  38. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  39. FUCK the communications decency act.  Goddamned government.  [literally.]
  40. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  41.